package com.wzy.level.user.userServiceImpl;

import com.wzy.Jdbc封装.pojo.News_user;
import com.wzy.level.byPage.byPageDto.ByPage;
import com.wzy.level.user.userDao.userDao;
import com.wzy.level.user.userDaoImpl.userDaoImpl;
import com.wzy.level.user.userService.userService;

import java.util.ArrayList;
import java.util.List;

public class userServiceImpl implements userService {
    userDao userDao = new userDaoImpl();
    @Override
    public List<News_user> selectAll() {

        List<News_user> news_users = userDao.selectAll();
        if (news_users.size()>0){
            return news_users;
        }else {
            return new ArrayList<News_user>();
        }
    }

    @Override
    public News_user selectById(int id) {
        return userDao.selectById(id);
    }

    @Override
    public List<News_user> selectByPage(ByPage byPage) {
        return userDao.selectByPage(byPage);
    }

    @Override
    public News_user selectByUsername(String username) {

            return userDao.selectByUsername(username);


    }



    @Override
    public int insert(News_user user) {
        return userDao.insert(user);
    }

    @Override
    public int update(News_user user) {
        return userDao.update(user);
    }

    @Override
    public int deleteById(News_user user) {
        return userDao.deleteById(user);
    }

    @Override
    public int deleteByName(News_user user) {
        return 0;
    }
}
